home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Online
/
LineShare 3.3.1
/
LineShare Scripts
/
Supra Voice&Fax1&ARA
< prev
next >
Wrap
Text File
|
1994-09-08
|
10KB
|
585 lines
!V2.2.10
!
!$ Use this script with Supra 14400bps and 9600bps fax modems.
!$ Supports: voice, fax, and ARA incoming calls.
!
!$ Make sure that *Class 1* fax software is installed, and that
!$ your modem has voice-capable ROMs.
!
!$ A hardware handshaking cable is required.
^2 Speaker On: = Enum("Never" = "0","During Connect" = "1","Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^6 Handshake wires: = Bool("Both"="&D0\K0","CTS only"="&D2\K5") "&D2\K5"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@HANGUP
SerReset 19200,0,8,1
HsReset 0,0,17,19,0,0
Flush
SetTries 2
write "ATH0S0=0\r"
Flush
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
write "AT+VC=0\r"
flush
write "AT&F1\r"
matchclr
matchstr 1 2 "OK\r\n"
matchread 20
! chrdelay 1
Write "+++"
! chrdelay 0
DtrClear
LBreak
DtrSet
write "AT+VC=0\r"
matchclr
matchstr 1 1 "OK\r\n"
matchread 10
!
write "ATE0V1\r"
matchstr 1 1 "OK\r\n"
matchread 10
write "ATH0\r"
matchstr 1 1 "OK\r\n"
matchread 10
DecTries
IfTries 0 1
exit -6019
@Label 2
SerReset 19200,0,8,1
Jsr 80
Write "AT+FCLASS=0\r"
Jsr 100
Write "AT+FAE=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
!
! Set the modem preferred speed first
!
SerReset 19200,0,8,1
Jsr 80
Jsr 70
@Label 3
ifOpen "Voice" 4
Jump 47
! check to see if the voice code has been downloaded
! if not, tell PhonePro to download it.
!
@Label 4
Note "Checking the modem..."
Write "AT+VC=0\r"
MatchClr
MatchStr 1 5 "OK\r\n"
MatchStr 2 5 "ERROR\r\n"
MatchRead 10
Exit -6019
@Label 5
Write "AT+VC=1\r"
MatchClr
MatchStr 1 7 "OK\r\n"
MatchStr 2 6 "ERROR\r\n"
MatchRead 20
Exit -6019
!
! tell the Voice Tool to download the voice code
!
@Label 6
Note "Downloading voice code to modem..."
Pause 20
QueueInput "\r\nLOAD\r\n"
Attach "Voice" (Master)
@Label 7
Write "AT+VC=0\r"
Jsr 100
!
! sit and wait for a call for up to 30 seconds, then re-initiate the modem
!
!@Label 8
!
! Get caller ID, if voice enabled
QueueInput "\r\nGET_CALLER_ID_FLAG\r\n"
Attach "Voice" (Master)
SetVar B "^$"
Write "AT#CID=^B\r"
Jsr 100
Note "Waiting for a Voice/Fax/ARA call"
MatchClr
MatchStr 1 15 "RING\r\n"
MatchRead 1800
Jump 3
@Label 15
Note "Ring..."
QueueInput "\r\nRING\r\n"
Attach "Voice" (Master)
Write "+++"
Note "Switching from voice..."
! fall through if the call is not a voice call (as indicated by the telephone tool)
!
SetVar A "^$"
SerReset 19200,0,8,1
! Jsr 80
HsReset 0,0,17,19,0,0
! Write "\r\r\r"
! Pause 10
Jsr 80
! Write "ATV1E0\r"
! Jsr 100
! Pause 2
! Write "AT&F\r"
! Jsr 100
! Jsr 70
IfStr A 17 "Fax"
IfStr A 18 "ARA"
Exit -6019
!
! Force to answer a Fax call
!
@Label 17
Note "Switching to Fax..."
Write "AT+FCLASS=1;+FAE=0\r"
Jsr 100
Write "AT&K4E0V0A\r"
MatchClr
MatchStr 1 30 "1\r"
MatchStr 2 93 "3\r"
MatchStr 3 94 "8\r"
MatchRead 300
Write "\r"
Exit -6019
!
! Force to answer an ARA call
!
@Label 18
Note "Switching to ARA..."
Jsr 70
! Set the communication options:
Jsr 55
Write "AT+FAE=0;+FCLASS=0\r"
Jsr 100
Write "ATA\r"
MatchClr
MatchStr 1 20 "\r\nCARRIER "
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
MatchRead 300
Write "\r"
Exit -6019
@Label 20
QueueInput "\r\nCARRIER "
ifOriginate 21
QueueInput "\r\nRING\r\n"
@Label 21
Attach "ARA" (DTR,Escape,TimeLimit=0)
!
! Fax connection has been established (we read "1\r")
! Attach the "Fax" subPort
!
@Label 30
QueueInput "1\r"
ifOriginate 32
@Label 31
QueueInput "2\r"
@Label 32
Attach "Fax" (DTR,Reset)
!
! Converting numeric responses into verbal
!
@Label 40
QueueInput "2400\r\n"
Jump 20
@Label 41
QueueInput "4800\r\n"
Jump 20
@Label 42
QueueInput "7200\r\n"
Jump 20
@Label 43
QueueInput "9600\r\n"
Jump 20
@Label 44
QueueInput "12000\r\n"
Jump 20
@Label 45
QueueInput "14400\r\n"
Jump 20
!
! Waiting for Fax/ARA calls only (no Voice App running)
!
@Label 47
Note "Voice Application is not running..."
Jsr 55
! No Voice App running -- turn off caller ID
Write "AT#CID=0\r"
Jsr 100
! This would allow us to not go into AA mode if we could have more labels.
ifOpen "ARA" 49
ifOpen "Fax" 49
Jump 160
!
!
! Set Fax mode
!
@Label 49
Write "AT\\N0&Q6&K3W1\r"
Jsr 100
Write "AT+FCLASS=1\r"
Jsr 100
Write "AT+FAE=1\r"
Jsr 100
Write "AT+FCLASS=0\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4V0\r"
Jsr 110
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 30 seconds, then reinitiate the modem
!
Note "Waiting for a fax or ARA call..."
MatchClr
matchstr 02 40 "47\r"
MatchStr 03 41 "48\r"
MatchStr 04 42 "49\r"
MatchStr 05 43 "50\r"
MatchStr 06 44 "51\r"
MatchStr 07 45 "52\r"
MatchStr 09 31 "33\r"
matchstr 10 53 "2\r"
matchstr 12 30 "1\r"
matchstr 13 52 "3\r"
matchstr 14 52 "8\r"
matchstr 15 52 "7\r"
@Label 51
Matchread 600
@Label 52
Write "ATV1\r"
Jsr 100
Jump 3
@Label 53
Note "Ring..."
Jump 51
! ------------------------------------------
! Originating a call through the "Voice" subport
! ------------------------------------------
@ORIGINATE "Voice" ("\r\nBusy\r\n")
Note "PhonePro is originating a call ..."
SerReset *
HsReset *
Jsr 80
! Jsr 60
Write "ATD^1\r"
Attach "Voice" (Escape,IdleLimit=30,Reset,DTR)
Exit -6019
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA" ("\r\nBusy\r\n")
SerReset *
HsReset *
Jsr 80
!
! Set the common options
!
Jsr 70
Jsr 55
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 20 "\r\nCARRIER "
MatchRead 1000
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax" ("\r\nBUSY\r\n")
! Clear the modem's magic memory
Jsr 130
!
! Set the "Fax" speed
!
SerReset *
HsReset *
Jsr 80
Write "ATZ\r"
Jsr 100
Write "AT+VC=0\r"
Jsr 120
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! &K4: Xon/Xoff handshake
!
Write "AT&K4+FCLASS=1\r"
Jsr 100
Write "AT+VC=0\r"
Jsr 120
!
! Now emit all commands that the application has sent to that port,
! except "+FCLASS", etc
!
EmitClear "+FCLASS","V","E","S0"
Jsr 60
Write "ATV0\r"
Jsr 110
!
! Prepare to receive all error result codes, dial the number
!
MatchClr
MatchStr 01 30 "1\r"
MatchStr 13 93 "3\r"
MatchStr 14 94 "8\r"
MatchStr 15 92 "7\r"
Write "ATD^1\r"
HsReset *
MatchRead 900
Write "\r"
Exit -6019
!
! Set the communication options:
! • \N0 &Q6: Normal connection (for ARA)
! • &K3: HW flow control (for ARA, Fax should not use a handshake on receiving)
! • W1: report connection speed
!
@Label 55
Write "AT\\N0&Q6&K3W1\r"
Jsr 100
return
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! extended responses + connect at the highest rate + speaker control +
! reset on Dtr drop + DCD valid
! Verbal responses mode, no echo
!
@Label 70
Write "ATX4N1M^2L^3^6&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "\r\r"
Pause 2
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes, send the dialing command and
! set the user's handshake mode
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 103 "\r\nOK\r\n"
MatchStr 2 102 "\r\nERROR\r\n"
@Label 101
MatchRead 20
@Label 102
Exit -6019
@Label 103
return
@Label 110
MatchClr
MatchStr 1 103 "0\r"
MatchStr 2 102 "4\r"
Jump 101
@Label 120
MatchClr
MatchStr 1 103 "\r\nOK\r\n"
MatchStr 2 103 "\r\nERROR\r\n"
MatchRead 20
Exit -6019
!This zeros out a location in memory that
!when cleared, enables STF to send/receive faxes.
@Label 130
MatchClr
Write "AT!2000M\r"
MatchStr 1 131 "\r\n2000: "
MatchRead 20
Jump 150
@Label 131
MatchClr
Write "00"
MatchStr 1 132 "\r\n2001: "
MatchRead20
Jump 150
@Label 132
MatchClr
Write "00"
MatchStr 1 133 "\r\n2002: "
MatchRead 20
Jump 150
@Label 133
MatchClr
Write "00"
MatchStr 1 134 "\r\n2003: "
MatchRead 20
Jump 150
@Label 134
MatchClr
Write "00"
MatchStr 1 135 "\r\n2004: "
MatchRead 20
Jump 150
@Label 135
MatchClr
Write " "
Jsr 100
@Label 136
MatchClr
Write "AT!2007M\r"
MatchStr 1 137 "\r\n2007: "
MatchRead 20
Jump 150
@Label 137
MatchClr
Write "00"
MatchStr 1 138 "\r\n2008: "
MatchRead20
Jump 150
@Label 138
MatchClr
Write "00"
MatchStr 1 139 "\r\n2009: "
MatchRead20
Jump 150
@Label 139
MatchClr
Write "00"
MatchStr 1 140 "\r\n200A: "
MatchRead20
Jump 150
@Label 140
MatchClr
Write "00"
MatchStr 1 141 "\r\n200B: "
MatchRead20
Jump 150
@Label 141
Write " "
Jsr 100
return
@Label 150
Note "Error clearing the modem's memory"
Pause 50
Write " "
return
@Label 160
write "ATS0=0\r"
Jsr 100
Note "Voice, ARA, and Fax not running"
Pause 300
Jump 3